package FourArithmeticOperations;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;

/**
 * Created by dell on 2017/9/25.
 */
public class linkandarray {
    public static void main(String[] arg) {
        Sorting sort = new Sorting();
        int n = 0;
        int m = 11;
        ArrayList<Integer> list = new ArrayList();
        LinkedList<Integer> list1 = new LinkedList();
        for (int i = 0; i < 10; i++) {
            n += 1;
            list.add(n);
            m += 1;
            list1.add(m);
        }//赋值
        ArrayList<Integer> list2 = new ArrayList();//新的列表
        for(int i=0;i<list.size();i++){
            list2.add(list.get(i));
            list2.add(list1.get(i));
        }
        int []arr = new int[list2.size()];//将列表转换为int类数组
        for(int i=0;i<list2.size();i++)
            arr[i] = list2.get(i);
        for (int i = 0;i<arr.length;i++){
            System.out.print(arr[i]+" ");//输出排序前数组内容
        }
            System.out.println();
            Arrays.sort(arr);//排序
        for (int i = 0;i<arr.length;i++){
            System.out.print(arr[i]+" ");//输出排序后内容
        }
    }
}
